package approve.action;

import java.util.List;

import nguyen.dao.ReceiverDocumentDAO;

import resource.pojo.BuyingDocument;

import model.pojo.Document;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class Re_View_Products extends Activity{
	TextView la_viewproductheader,la_viewproductheader2;
	ListView list;
	Document doc;
	String databasename="admin";
	
	Bundle language=null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.re_view_products);
		language=getIntent().getExtras().getBundle(getIntent().getExtras().getString("lang"));
		doc=(Document) getIntent().getExtras().get("doc");
		databasename=getIntent().getExtras().getString("database");
		
		la_viewproductheader=(TextView) findViewById(R.id.la_viewproductheader);
		la_viewproductheader2=(TextView) findViewById(R.id.la_viewproductheader2);
		la_viewproductheader.setText(language.getString("ac_lien_STenSanPham")+" - "+language.getString("ac_CompanyName"));
		la_viewproductheader2.setText("("+language.getString("ac_lien_SGia")+" _ "+language.getString("ac_lien_SGia")+"(VAT 10%) x "+language.getString("ac_lien_SSoLuong")+")");
		
		list=(ListView) findViewById(R.id.listProducts);
		List<BuyingDocument> listProducts=ReceiverDocumentDAO.getListProducts(databasename, doc.getId());
		
		if(listProducts.size()>0){
			re_viewproduct_adapter adapter=new re_viewproduct_adapter(this,listProducts);
			list.setAdapter(adapter);
		}
		
		
	}

}
